home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / EXAMPLES / IDRAW / LISTIBRU.H < prev    next >
C/C++ Source or Header  |  1980-01-05  |  3KB  |  91 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: listibrush.h,v 1.9 89/10/09 14:48:46 linton Exp $
  24. // declares classes IBrushNode and IBrushList.
  25.  
  26. #ifndef listibrush_h
  27. #define listibrush_h
  28.  
  29. #include "list.h"
  30.  
  31. // Declare imported types.
  32.  
  33. class IBrush;
  34.  
  35. // An IBrushNode contains an IBrush pointer.
  36.  
  37. class IBrushNode : public BaseNode {
  38. public:
  39.  
  40.     IBrushNode (IBrush* b) { brush = b; }
  41.     boolean SameValueAs (void* p) { return brush == p; }
  42.     IBrush* GetBrush () { return brush; }
  43.  
  44. protected:
  45.  
  46.     IBrush* brush;        // points to an IBrush
  47.  
  48. };
  49.  
  50. // An IBrushList manages a list of IBrushNodes.
  51.  
  52. class IBrushList : public BaseList {
  53. public:
  54.  
  55.     IBrushNode* First();
  56.     IBrushNode* Last();
  57.     IBrushNode* Prev();
  58.     IBrushNode* Next();
  59.     IBrushNode* GetCur();
  60.     IBrushNode* Index(int);
  61.  
  62. };
  63.  
  64. // Cast these functions to return IBrushNodes instead of BaseNodes.
  65.  
  66. inline IBrushNode* IBrushList::First () {
  67.     return (IBrushNode*) BaseList::First();
  68. }
  69.  
  70. inline IBrushNode* IBrushList::Last () {
  71.     return (IBrushNode*) BaseList::Last();
  72. }
  73.  
  74. inline IBrushNode* IBrushList::Prev () {
  75.     return (IBrushNode*) BaseList::Prev();
  76. }
  77.  
  78. inline IBrushNode* IBrushList::Next () {
  79.     return (IBrushNode*) BaseList::Next();
  80. }
  81.  
  82. inline IBrushNode* IBrushList::GetCur () {
  83.     return (IBrushNode*) BaseList::GetCur();
  84. }
  85.  
  86. inline IBrushNode* IBrushList::Index (int index) {
  87.     return (IBrushNode*) BaseList::Index(index);
  88. }
  89.  
  90. #endif
  91.